<?php

namespace App\Http\Requests\Plane\Order;

use Illuminate\Foundation\Http\FormRequest;

class PlaneChangeApplyRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array<string, mixed>
     */
    public function rules()
    {
        return [
            "order_sn"                 => "required",
            "change_type"              => "required",
            "passengers"               => "required",
            "passenger.*.passenger_id" => "required",
            "order"                    => "required",
            "order.flight_no"          => "required",
        ];
    }

    public function messages(): array
    {
        return [
            "order_sn.required"                 => '参数错误，订单编号必传',
            "change_type.required"              => '参数错误，改签类型必传',
            "passengers.required"               => '参数错误，乘客必传',
            "order.required"                    => '参数错误，改签航班数据必传',
            "passenger.*.passenger_id.required" => '参数错误，乘客id必传',
            "order.flight_no.required"          => '参数错误，航班号必传',
        ];
    }
}
